<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>案例1 电灯开关</title>

</head>
<body>

<img id="5g" src="5G.jpg">
<!--<img id="champion" src="Champion.jpg">-->
<script>
    var flag = true;

    function change() {
        if (flag) {
            obj.src = "5G.jpg"
            flag = false
        } else {
            obj.src="Champion.jpg"
            flag = true
        }

    }
</script>
<script>
    var obj = document.getElementById("5g");

    obj.onclick = change;
</script>

</body>
</html>